Component({
  properties: {
    playing: { // 控制是否播放动画
      type: Boolean,
      value: false
    },
    count: { // 柱条数量
      type: Number,
      value: 30
    }
  },
  data: {
    bars: [] // 每个柱条的高度、节奏、延迟
  },
  lifetimes: {
    attached() {
      this.initBars();
    }
  },
  methods: {
    initBars() {
      const bars = [];
      for (let i = 0; i < this.data.count; i++) {
        bars.push({
          height: 10 + Math.random() * 16, // 随机初始高度
          duration: (1.2 + Math.random() * 0.6).toFixed(2), // 随机节奏
          delay: (-Math.random() * 1.5).toFixed(2) // 负延迟防止突兀
        });
      }
      this.setData({ bars });
    }
  }
});
